home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 428_02 / examples / multedit.c < prev    next >
C/C++ Source or Header  |  1994-03-13  |  865b  |  43 lines

  1. /*
  2. ** MULTEDIT.C: Uses multiedit to display a dialog box with
  3. ** multiple edit fields.
  4. */
  5.  
  6. #include <stdio.h>
  7. #include <pictor.h>
  8.  
  9. #define MAX_LEN        25
  10. char buff1[MAX_LEN + 1];
  11. char buff2[MAX_LEN + 2];
  12.  
  13. #define NUM_ITEMS    2
  14. MEDITSTRUCT items[NUM_ITEMS] = {
  15.    { "Find What",buff1,MAX_LEN },
  16.    { "Replace with",buff2,MAX_LEN }
  17. };
  18.  
  19. COLORSTRUCT colors = {
  20.    foreback(BLACK,WHITE),
  21.    foreback(BOLD+WHITE,WHITE),
  22.    foreback(WHITE,BLACK),
  23.    foreback(BOLD+WHITE,BLACK)
  24. };
  25.  
  26. void main()
  27. {
  28.    char buffer[81];
  29.  
  30.    /* initialize library */
  31.    initvideo();
  32.  
  33.    if(multiedit(items,NUM_ITEMS,"Replace",&colors)) {
  34.       sprintf(buffer,"You entered:\n\"%s\"\nand:\n\"%s\"",
  35.          buff1,buff2);
  36.       messagebox(buffer,NULL,MB_OK,&colors);
  37.    }
  38.    else {
  39.       messagebox("You pressed <Escape>",NULL,MB_OK,
  40.          &colors);
  41.    }
  42. }
  43.